import request from '@/config/axios'

// 题库章节 VO
export interface BankChapterVO {
  id: number // id
  bankId: number // 题库id
  name: string // 名称
  parentId: number // 父id
  sort: number // 显示顺序
  idTree: string // 完整路径
  status: number // 状态（0正常 1停用）
}

// 题库章节 API
export const BankChapterApi = {
  // 查询题库章节列表
  getBankChapterList: async (params) => {
    return await request.get({ url: `/exam/bank-chapter/list`, params })
  },

  // 查询题库章节列表
  getSimpleBankChapterList: async (params) => {
    return await request.get({ url: `/exam/bank-chapter/list/simple`, params })
  },

  // 查询题库章节详情
  getBankChapter: async (id: number) => {
    return await request.get({ url: `/exam/bank-chapter/get?id=` + id })
  },

  // 新增题库章节
  createBankChapter: async (data: BankChapterVO) => {
    return await request.post({ url: `/exam/bank-chapter/create`, data })
  },

  // 修改题库章节
  updateBankChapter: async (data: BankChapterVO) => {
    return await request.put({ url: `/exam/bank-chapter/update`, data })
  },

  // 删除题库章节
  deleteBankChapter: async (id: number) => {
    return await request.delete({ url: `/exam/bank-chapter/delete?id=` + id })
  },

  // 导出题库章节 Excel
  exportBankChapter: async (params) => {
    return await request.download({ url: `/exam/bank-chapter/export-excel`, params })
  }
}
